package uit.comstore.model.blo;

import java.util.List;
import org.hibernate.Session;
import uit.comstore.model.entity.Bill;
import uit.comstore.utils.HibernateSessionFactory;

public class BillBLO {
	
	@SuppressWarnings("unchecked")
	public List<Bill> list() {
		List<Bill> bill = null;
		Session session = HibernateSessionFactory.getSessionFactory().getCurrentSession();
		session.beginTransaction();
		bill = (List<Bill>) session.createQuery("from Bill").list();
		session.getTransaction().commit();
		return bill;
	}
	public Bill add(Bill bill){
		Session session = HibernateSessionFactory.getSessionFactory().getCurrentSession();
		session.beginTransaction();
		session.save(bill);
		session.getTransaction().commit();
		return bill;
	}	
}
